﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace HubbleTelescope.Framework
{
    /// <summary>
    /// Class enabling simple INotifyPropertyChanged implementation
    /// </summary>
    public abstract class PropertyChangedBase : INotifyPropertyChanged
    {
        #region INotifyPropertyChanged Members

        /// <summary>
        /// Event for when a property changes
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged = delegate { };

        #endregion

        /// <summary>
        /// Raises PropertyChanged on the proper UI thread
        /// </summary>
        /// <param name="name">Name of property that changed</param>
        protected void OnPropertyChanged(string name)
        {
            Execute.OnUIThread(() => PropertyChanged(this, new PropertyChangedEventArgs(name)));
        }
    }
}
